/**
 * docx 报告 导出统一样式配置
 */

import { CSSProperties, readonly } from 'vue'

interface DefaultDocxConfig {
  title: CSSProperties
  body: CSSProperties
  HEADDING_1: CSSProperties
  HEADDING_2: CSSProperties
  HEADDING_3: CSSProperties
  a4: {
    margins: {
      top: number
      left: number
      bottom: number
      right: number
    }
    /**
     * 单位为 in  英尺
     */
    templateMargins: {
      top: number
      left: number
      bottom: number
      right: number
    }
    pageWidth: number
    pageHeight: number
  }
}

const defineDocxConfig = (val: DefaultDocxConfig) => readonly(val)

/**
 * 1毫米 = 1/25.4 英寸
 * 1毫米 = 1440 Twips / 25.4
 * 1毫米 ≈ 56.69291 Twips
 * 一英寸等于25.4毫米
 *
 * a4:
 *  上下边距 32毫米 左右 25毫米
 */

export default defineDocxConfig({
  a4: {
    pageWidth: 11906,
    pageHeight: 16838,
    margins: {
      top: 1814,
      bottom: 1814,
      left: 1417,
      right: 1417
    },
    templateMargins: {
      top: 32 / 25.4,
      bottom: 32 / 25.4,
      left: 25 / 25.4,
      right: 25 / 25.4
    }
  },
  title: {
    fontSize: '24pt',
    fontFamily: '方正小标宋_GBK',
    fontWeight: 'bold',
    lineHeight: '31pt',
    letterSpacing: '0.4pt'
  },
  body: {
    fontSize: '18pt',
    fontFamily: '方正仿宋_GBK',
    fontWeight: 'bold',
    lineHeight: '31pt',
    letterSpacing: '0.4pt'
  },

  HEADDING_1: {
    fontSize: '18pt',
    fontFamily: '方正黑体_GBK',
    fontWeight: 'bold',
    lineHeight: '31pt',
    letterSpacing: '0.4pt'
  },
  HEADDING_2: {
    fontSize: '18pt',
    textIndent: '2em',
    fontFamily: '方正楷体_GBK',
    fontWeight: 'bold',
    lineHeight: '31pt',
    letterSpacing: '0.4pt'
  },
  HEADDING_3: {
    fontSize: '18pt',
    textIndent: '2em',
    fontFamily: '方正仿宋_GBK',
    fontWeight: 'bold',
    lineHeight: '31pt',
    letterSpacing: '0.4pt'
  }
})
